package com.ab;

import org.junit.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

//import sun.jvm.hotspot.utilities.Assert;

/**
 * Created by IntelliJ IDEA.
 * User: Anna.Bulenkova
 * Date: 21.10.11
 * Time: 11:01
 * To change this template use File | Settings | File Templates.
 */
public class BinaryPointTest {
    @Test
    public void testHasNext() throws Exception {
       assert new BinaryPoint(false, false).hasNext();
       assert new BinaryPoint(false, true).hasNext();
       assert ! new BinaryPoint(true, true, true).hasNext();
    }


    @Test
    public void testNext() throws Exception {
        Map<BinaryPoint, BinaryPoint> testData = new HashMap<BinaryPoint, BinaryPoint>();
        testData.put(BinaryPoint.createZeroPoint(3),        new BinaryPoint(false, false, true));
        testData.put(new BinaryPoint(false, true, true),    new BinaryPoint(true, false, false));
        testData.put(new BinaryPoint(true, true, true),     null);

        for (BinaryPoint point : testData.keySet()) {
            junit.framework.Assert.assertEquals(point.next(), testData.get(point));
        }
    }

    @Test
    public void testCreateZeroPoint() throws Exception {
        assert Arrays.equals(BinaryPoint.createZeroPoint(3).getCoords(),new boolean[3]);
    }
}
